<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
include ("../conn/conn.php");
$conn = prepare();

$leibie=$_POST['leibie'];

$sql= exectue_sql_statement($conn, "select * from Classification where classify_name='$leibie'");
$info=sqlsrv_fetch_array($sql);
if($info!=false){
 echo"<script>alert('该类别已经存在!');window.location.href='addclass.php';</script>";
exit;
}
exectue_sql_statement($conn, "insert into Classification(classify_name) values ('$leibie')");
echo"<script>alert('新类别添加成功!');window.location.href='addclass.php';</script>";
?>